$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + 'onlinestudy/xcbm/statisticOnlineStudy',
        datatype: "json",
        mtype: "post",
        colModel: [
            {
                label: '学习类型', name: 'bmlx', index: 'bmlx', width: 80, formatter: (value, options, rowObj) => {
                if (value == "0") return "满分学习"; else if(value == "1") return "审验学习"; else return value;
            }
            },
            {label: '未学完课程', name: 'wxw', index: 'wxw', width: 130},
            {label: '已学完', name: 'xw', index: 'xw', width: 100},
            {label: '未审核', name: 'wsh', index: 'wsh', width: 80},
            {label: '通过', name: 'tg', index: 'tg', width: 60},
            {label: '不通过', name: 'wtg', index: 'wtg', width: 60},
            {label: '合计', name: 'zs', index: 'zs', width: 120}
        ],
        viewrecords: true,
        height: 290,
        rowNum: 100,
        rowList: [100],
        rownumbers: true,
        rownumWidth: 25,
        autowidth: true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader: {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames: {
            page: "page",
            rows: "limit",
            order: "order"
        },
        footerrow: true,
        gridComplete: function () {
            var xwtotal = $("#jqGrid").getCol("xw", false, 'sum');
            var wxwtotal = $("#jqGrid").getCol("wxw", false, 'sum');
            var wshtotal = $("#jqGrid").getCol("wsh", false, 'sum');
            var tgtotal = $("#jqGrid").getCol("tg", false, 'sum');
            var wtgtotal = $("#jqGrid").getCol("wtg", false, 'sum');
            var total = $("#jqGrid").getCol("zs", false, "sum");
            $("#jqGrid").footerData('set', {
                "bmlx": "合计",
                "wxw": wxwtotal,
                "xw": xwtotal,
                "wsh": wshtotal,
                "tg": tgtotal,
                "wtg": wtgtotal,
                "zs": total
            });
            //隐藏grid底部滚动条
            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
        }
    });
});